package com.mini.config;

import cn.hutool.core.util.EnumUtil;
import com.mini.enums.YesOrNoEnum;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Data
@Component
public class MyWebSocketConfig {

    @Value("${config.websocket.heart-bate-time}")
    private Integer heartBateTime;

    private YesOrNoEnum openHeartBate;

    @Value("${config.websocket.open-heart-bate:N}")
    public void setOpenHeartBate(String openHeartBate) {
        this.openHeartBate = EnumUtil.getBy(YesOrNoEnum::getCode, openHeartBate);
    }

}
